package com.yulongtian.principles.demo02.after;

/**
 * @author YulongTian
 * @date 2022/7/8 - 14:53
 */
public class Client {

    public static void main(String[] args) {
        //创建长方形对象
        Rectangle r=new Rectangle();
        r.setLength(20);
        r.setWidth(10);
        //调用方法扩宽
        resize(r);
        printLengthAndWidth(r);

    }

    //扩宽的方法
    public static void resize(Rectangle rectangle) {
        //判断宽如果比长小，则进行扩宽操作
        while (rectangle.getWidth() <= rectangle.getLength()) {
            rectangle.setWidth(rectangle.getWidth() + 1);
        }
    }

    //打印长和宽
    public static void printLengthAndWidth(SiBianXing siBianXing) {
        System.out.println("长：" + siBianXing.getLength());
        System.out.println("宽：" + siBianXing.getWidth());


    }

}
